# coding = utf-8

# 服务器短

import socket
server = socket.socket()
server.bind(('localhost', 6969))    # 绑定要监听的端口
server.listen(5)     # 监听,最大允许多少个链接

print("我要开始等电话了")
while True:
    conn, addr = server.accept()  # 等电话打进来
    # conn 就是客户端连过来而在服务器端为其生成的实例
    print("开始接电话了")
    while True:
        data = conn.recv(1024)
        print("recv:", data.decode())
        if not data:
            print("client has lost...")
            break
        conn.send(data.upper())


server.close()





